package com.xinwei.leetcode.数组;

public class _303_区域和检索_数组不可变 {
    int[] newNums;

    public _303_区域和检索_数组不可变(int[] nums) {
        this.newNums = new int[nums.length];
        for (int i = 0; i < nums.length; i++) {
            newNums[i] = nums[i];
        }
    }

    public int sumRange(int left, int right) {
        int sum = 0;
        for (int i = left; i < right; i++) {
            sum += newNums[i];
        }
        return sum;
    }
}
